<html>
<head><meta charset="utf-8"><title>New syntax for &quot;enable feature but don&#x27;t enable crate&quot;? · t-cargo · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/index.html">t-cargo</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/New.20syntax.20for.20.22enable.20feature.20but.20don&#x27;t.20enable.20crate.22.3F.html">New syntax for &quot;enable feature but don&#x27;t enable crate&quot;?</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="210098854"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/New%20syntax%20for%20%22enable%20feature%20but%20don%27t%20enable%20crate%22%3F/near/210098854" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/New.20syntax.20for.20.22enable.20feature.20but.20don&#x27;t.20enable.20crate.22.3F.html#210098854">(Sep 15 2020 at 07:38)</a>:</h4>
<p>Inspired by some <a href="https://internals.rust-lang.org/t/pre-rfc-packages-as-optional-namespaces/13059/35">discussions</a> related to the use of <code>/</code> in <code>Cargo.toml</code>, as well as some previous discussions about improving feature handling, I'd like to float a possible new syntax for specifying what a feature enables in the <code>[features]</code> section:</p>
<ul>
<li>Add a new feature separator <code>@</code>, such that <code>foo@bar</code> means "the <code>bar</code> feature of <code>foo</code>", but does not enable <code>foo</code> itself. So, if you want to enable <code>foo</code> and its <code>bar</code> feature, you'd write <code>["foo", "foo@bar"]</code>.</li>
</ul>



<a name="210098879"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/New%20syntax%20for%20%22enable%20feature%20but%20don%27t%20enable%20crate%22%3F/near/210098879" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/New.20syntax.20for.20.22enable.20feature.20but.20don&#x27;t.20enable.20crate.22.3F.html#210098879">(Sep 15 2020 at 07:38)</a>:</h4>
<p>This would allow for things like "if you enable <code>featx</code>, you also need the <code>featx</code> feature of <code>dep</code>, if you want <code>dep</code> at all".</p>



<a name="210127112"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/New%20syntax%20for%20%22enable%20feature%20but%20don%27t%20enable%20crate%22%3F/near/210127112" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/New.20syntax.20for.20.22enable.20feature.20but.20don&#x27;t.20enable.20crate.22.3F.html#210127112">(Sep 15 2020 at 13:14)</a>:</h4>
<p>The idea seems reasonable to me, but the syntax may be a bit cryptic if you haven't seen it before</p>



<a name="210127240"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/New%20syntax%20for%20%22enable%20feature%20but%20don%27t%20enable%20crate%22%3F/near/210127240" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/New.20syntax.20for.20.22enable.20feature.20but.20don&#x27;t.20enable.20crate.22.3F.html#210127240">(Sep 15 2020 at 13:16)</a>:</h4>
<p>it does match <code>binding @ pat</code> which is kind of cute</p>



<a name="210127261"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/New%20syntax%20for%20%22enable%20feature%20but%20don%27t%20enable%20crate%22%3F/near/210127261" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/New.20syntax.20for.20.22enable.20feature.20but.20don&#x27;t.20enable.20crate.22.3F.html#210127261">(Sep 15 2020 at 13:16)</a>:</h4>
<p>no opinions on the feature itself though</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>